import { Injectable } from "@nestjs/common";
import { InjectRepository } from "@nestjs/typeorm";
import { Repository } from "typeorm";

import { AppDueTpl, AppDueSku } from "qqlx-core";
import { AppDueTplGateway, AppDueSkuGateway } from "qqlx-core";
import { AppDueTplSchema, AppDueSkuSchema } from "qqlx-cdk";

import { PgDao } from "../../lib/dao.pg.id";

@Injectable()
export class AppDueTplDao extends PgDao<AppDueTpl> {
  constructor(
    @InjectRepository(AppDueTplSchema)
    readonly repo: Repository<AppDueTpl>,
  ) {
    super({
      repository: repo,
      relations_name: AppDueTplGateway.relations,
    });
  }
}

@Injectable()
export class AppDueSkuDao extends PgDao<AppDueSku> {
  constructor(
    @InjectRepository(AppDueSkuSchema)
    readonly repo: Repository<AppDueSku>,
  ) {
    super({
      repository: repo,
      relations_name: AppDueSkuGateway.relations,
    });
  }
}
